package com.example.demo.controller;

import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@EnableCaching
public class HelloController {
	
	// http://localhost:8080/hello?name=111
    @RequestMapping("/hello")
    @Cacheable(value="helloCache", condition="#name!=null")
    public String hello(String name) {
    	System.out.println("没有走缓存！");
        return "hello "+name;
    }
}
